package com.bxd.baodan.mvp.base;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.bxd.baodan.fragment.BaseFragment;

/**
 * Created by Administrator on 2017/5/23.
 */

public abstract class MvpBaseFragment<V extends IView, P extends BasePresenter<V>> extends BaseFragment {
    protected P presenter;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        presenter = createPresenter();//创建Presenter
        presenter.attachView((V)this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        presenter.detachView();
    }

    protected abstract P createPresenter();
}
